PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPThrowException

Throws an exception to a specified task.

OSStatus MPThrowException (
                     MPTaskID task,
                     MPExceptionKind kind);
task
A value of type MPTaskID that specifies the task to which the exception should be thrown.
kind
A value of type ExceptionKind that specifies the type of exception to give to the task.
function result
A result code. See Result Codes for a list of possible values. If the task is already suspended or if the task is not defined to take thrown exceptions, the function returns kMPInsufficientResourcesErr .
DISCUSSION

The exception is treated in the same manner as any other exception taken by a task. However, since it is asynchronous, it may not be presented immediately.

By convention, you should set the exception kind to kMPTaskStoppedErr if you want to suspend a task. In general, you should do so only if you are debugging and wish to examine the state of the task. Otherwise you should block the task using one of the traditional notification mechanisms (such as a message queue).

An exception can be thrown at any time, whether that task is running, eligible to be run (that is, ready), or blocked. The task is suspended and an exception message may be generated the next time the task is about to run. Note that this may never occur-- for example, if the task is deadlocked or the resource it is waiting on is never released. If the task is currently blocked when this function is executed, kMPTaskBlockedErr is returned. If the task was suspended immediately at the conclusion of this function call the return value is kMPTaskStoppedErr .

VERSION NOTES

Introduced with Multiprocessing Services 2.0.


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)